<template>
  <div class="m-order-search-btns">
    <!-- 订单搜素btns -->
    <div class="search-btn" v-for="(btn, index) in searchBtns" :key="index" :class="{'actived': index == curBtns}" @click="onChangeBtns(index, btn.status)">
      <span class="btns">{{btn.title}}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    searchBtns: {
      type: Array,
      default() {
        return [
          {
            title: '全部',
            status: ''
          }
        ]
      }
    }
  },
  data() {
    return {
      curBtns: 0
    }
  },
  methods: {
    /**
     * 切换btns
     */
    onChangeBtns(index, curBtns) {
      this.curBtns = index
      // 通知父级，当前的搜索条件
      this.$emit('on-changeBtns', curBtns)
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../../../scss/_var.scss';
.m-order-search-btns {
  width: 100%;
  border-bottom: 1px solid #dddddd;
  .search-btn {
    display: inline-block;
    &:after {
      content: '|';
      color: #979797;
    }
    &:last-child {
      &:after {
        content: ''
      }
    }
  }
  .btns {
    display: inline-block;
    cursor: pointer;
    padding: 0 20px 10px;
  }
  .actived {
    color: $color-main;
    border-bottom: 2px solid
  }
}
</style>
